import { createStore } from 'vuex'
import getters from './getters'
const importAllModules = () => {
  const context = require.context('./modules', true, /.+\.ts$/)
  const modules: any = {}
  context.keys().forEach((key) => {
    const name = key.replace(/^.+\/(.+)\.ts$/, '$1')
    modules[name] = context(key).default
  })
  return modules
}

export default createStore({
  state: {},
  mutations: {},
  actions: {},
  getters,
  modules: importAllModules()
})
